package br.com.mtg.movethegarbage.game;

import br.com.mtg.movethegarbage.framework.Game;
import br.com.mtg.movethegarbage.framework.Music;
import br.com.mtg.movethegarbage.framework.Sound;
import br.com.mtg.movethegarbage.graphics.Sprite;
import br.com.mtg.movethegarbage.graphics.TexFont;
import br.com.mtg.movethegarbage.graphics.Texture;

public class Assets
{
	// Textures
	public static Texture tex_sprites;
	public static Texture tex_splash;
	public static Texture tex_splash2;
	public static Texture tex_backgroundScreenRedMain;
	public static Texture tex_backgroundScreenBlueYellow;
	public static Texture tex_backgroundScreenOrangeGreen;

	// Sprites
	public static Sprite splash;
	public static Sprite splash2;
	public static Sprite mainMenuScreen;
	public static Sprite background;
	public static Sprite redScreen;
	public static Sprite yellowScreen;
	public static Sprite blueScreen;
	public static Sprite orangeScreen;
	public static Sprite greenScreen;

	public static Sprite buttonRed1;
	public static Sprite buttonRed2;
	public static Sprite buttonRed3;
	public static Sprite buttonRed4;
	public static Sprite buttonRedLocked;

	public static Sprite buttonBlue5;
	public static Sprite buttonBlue6;
	public static Sprite buttonBlue7;
	public static Sprite buttonBlue8;
	public static Sprite buttonBlueLocked;

	public static Sprite buttonYellow9;
	public static Sprite buttonYellow10;
	public static Sprite buttonYellow11;
	public static Sprite buttonYellow12;
	public static Sprite buttonYellowLocked;

	public static Sprite buttonGreen13;
	public static Sprite buttonGreen14;
	public static Sprite buttonGreen15;
	public static Sprite buttonGreen16;
	public static Sprite buttonGreenLocked;

	public static Sprite buttonOrange17;
	public static Sprite buttonOrange18;
	public static Sprite buttonOrange19;
	public static Sprite buttonOrange20;
	public static Sprite buttonOrangeLocked;

	public static Sprite SPRITE_GRASS;
	public static Sprite SPRITE_WALL;
	public static Sprite SPRITE_GROUND;
	public static Sprite SPRITE_TREE;

	public static Sprite SPRITE_BOX_PAPER;
	public static Sprite SPRITE_BOX_PLASTIC;
	public static Sprite SPRITE_BOX_METAL;
	public static Sprite SPRITE_BOX_GLASS;
	public static Sprite SPRITE_BOX_BATTERY;

	public static Sprite SPRITE_BIN_PAPER;
	public static Sprite SPRITE_BIN_PLASTIC;
	public static Sprite SPRITE_BIN_METAL;
	public static Sprite SPRITE_BIN_GLASS;
	public static Sprite SPRITE_BIN_BATTERY;

	public static Sprite SPRITE_PLAYER_DOWN;
	public static Sprite SPRITE_PLAYER_LEFT;
	public static Sprite SPRITE_PLAYER_RIGHT;
	public static Sprite SPRITE_PLAYER_UP;

	public static Sprite buttonBackgroundRect;
	public static Sprite buttonBackgroundCirc;
	public static Sprite buttonInfo;
	public static Sprite buttonExtra;
	public static Sprite buttonSoundOn;
	public static Sprite buttonSoundOff;
	public static Sprite buttonBack;
	public static Sprite buttonArrowGreen;
	public static Sprite buttonArrowGray;
	public static Sprite buttonArrowWhite1;
	public static Sprite buttonArrowWhite2;

	public static Sprite spriteNo;
	public static Sprite spriteYes;

	public static Sprite textboxBackground;

	// Sounds
	public static Sound push;

	// Music
	public static Sound startSound;
	public static Sound clickSound;
	public static Music music1;
	public static Music music2;
	public static Music music3;

	// Text Font
	public static TexFont font;

	public static void load(Game game) throws Exception
	{
		tex_splash = new Texture(game, "splash.png");
		tex_sprites = new Texture(game, "sprites.png");
		tex_backgroundScreenRedMain = new Texture(game, "screens_red_background.png");
		tex_backgroundScreenBlueYellow = new Texture(game, "screens_blue_yellow.png");
		tex_backgroundScreenOrangeGreen = new Texture(game, "screens_orange_green.png");
		tex_splash2 = new Texture(game, "splash2.png");

		splash = new Sprite(tex_splash, 0, 0, 512, 427);
		splash2 = new Sprite(tex_splash2, 0, 0, 455, 220);
		redScreen = new Sprite(tex_backgroundScreenRedMain, 0, 0, 384, 256);
		background = new Sprite(tex_backgroundScreenRedMain, 0, 256, 384, 256);
		yellowScreen = new Sprite(tex_backgroundScreenBlueYellow, 0, 0, 384, 256);
		blueScreen = new Sprite(tex_backgroundScreenBlueYellow, 0, 256, 384, 256);
		orangeScreen = new Sprite(tex_backgroundScreenOrangeGreen, 0, 0, 384, 256);
		greenScreen = new Sprite(tex_backgroundScreenOrangeGreen, 0, 256, 384, 256);

		SPRITE_GRASS = new Sprite(tex_sprites, 448, 64, 64, 64);
		SPRITE_WALL = new Sprite(tex_sprites, 384, 0, 64, 64);
		SPRITE_GROUND = new Sprite(tex_sprites, 448, 0, 64, 64);
		SPRITE_TREE = new Sprite(tex_sprites, 320, 0, 64, 64);

		SPRITE_BOX_BATTERY = new Sprite(tex_sprites, 0, 0, 64, 64);
		SPRITE_BOX_METAL = new Sprite(tex_sprites, 64, 0, 64, 64);
		SPRITE_BOX_PAPER = new Sprite(tex_sprites, 128, 0, 64, 64);
		SPRITE_BOX_PLASTIC = new Sprite(tex_sprites, 192, 0, 64, 64);
		SPRITE_BOX_GLASS = new Sprite(tex_sprites, 256, 0, 64, 64);

		SPRITE_BIN_BATTERY = new Sprite(tex_sprites, 0, 64, 64, 64);
		SPRITE_BIN_METAL = new Sprite(tex_sprites, 64, 64, 64, 64);
		SPRITE_BIN_PAPER = new Sprite(tex_sprites, 128, 64, 64, 64);
		SPRITE_BIN_PLASTIC = new Sprite(tex_sprites, 192, 64, 64, 64);
		SPRITE_BIN_GLASS = new Sprite(tex_sprites, 256, 64, 64, 64);

		SPRITE_PLAYER_DOWN = new Sprite(tex_sprites, 320, 64, 64, 64);
		SPRITE_PLAYER_LEFT = new Sprite(tex_sprites, 384, 64, 64, 64);
		SPRITE_PLAYER_RIGHT = new Sprite(tex_sprites, 0, 176, 64, 64);
		SPRITE_PLAYER_UP = new Sprite(tex_sprites, 0, 240, 64, 64);

		buttonBackgroundRect = new Sprite(tex_sprites, 0, 328, 250, 90);
		buttonBackgroundCirc = new Sprite(tex_sprites, 296, 228, 100, 100);
		buttonInfo = new Sprite(tex_sprites, 96, 128, 100, 100);
		buttonExtra = new Sprite(tex_sprites, 196, 128, 100, 100);
		buttonSoundOn = new Sprite(tex_sprites, 296, 128, 100, 100);
		buttonSoundOff = new Sprite(tex_sprites, 396, 128, 100, 100);
		buttonBack = new Sprite(tex_sprites, 96, 228, 100, 100);
		buttonArrowGreen = new Sprite(tex_sprites, 196, 228, 100, 100);
		buttonArrowGray = new Sprite(tex_sprites, 396, 228, 100, 100);
		buttonArrowWhite2 = new Sprite(tex_sprites, 250, 329, 100, 100);
		buttonArrowWhite1 = new Sprite(tex_sprites, 350, 329, 100, 100);

		spriteNo = new Sprite(tex_sprites, 0, 128, 48, 48);
		spriteYes = new Sprite(tex_sprites, 48, 128, 48, 48);

		buttonRed1 = new Sprite(tex_backgroundScreenRedMain, 384, 0, 51, 51);
		buttonRed2 = new Sprite(tex_backgroundScreenRedMain, 435, 0, 51, 51);
		buttonRed3 = new Sprite(tex_backgroundScreenRedMain, 384, 51, 51, 51);
		buttonRed4 = new Sprite(tex_backgroundScreenRedMain, 435, 51, 51, 51);
		buttonRedLocked = new Sprite(tex_backgroundScreenRedMain, 384, 102, 51, 51);

		buttonBlue5 = new Sprite(tex_backgroundScreenBlueYellow, 384, 0, 51, 51);
		buttonBlue6 = new Sprite(tex_backgroundScreenBlueYellow, 435, 0, 51, 51);
		buttonBlue7 = new Sprite(tex_backgroundScreenBlueYellow, 384, 51, 51, 51);
		buttonBlue8 = new Sprite(tex_backgroundScreenBlueYellow, 435, 51, 51, 51);
		buttonBlueLocked = new Sprite(tex_backgroundScreenBlueYellow, 384, 102, 51, 51);

		buttonYellow9 = new Sprite(tex_backgroundScreenBlueYellow, 435, 102, 51, 51);
		buttonYellow10 = new Sprite(tex_backgroundScreenBlueYellow, 384, 153, 51, 51);
		buttonYellow11 = new Sprite(tex_backgroundScreenBlueYellow, 435, 153, 51, 51);
		buttonYellow12 = new Sprite(tex_backgroundScreenBlueYellow, 384, 204, 51, 51);
		buttonYellowLocked = new Sprite(tex_backgroundScreenBlueYellow, 435, 204, 51, 51);

		buttonGreen13 = new Sprite(tex_backgroundScreenOrangeGreen, 384, 0, 51, 51);
		buttonGreen14 = new Sprite(tex_backgroundScreenOrangeGreen, 435, 0, 51, 51);
		buttonGreen15 = new Sprite(tex_backgroundScreenOrangeGreen, 384, 51, 51, 51);
		buttonGreen16 = new Sprite(tex_backgroundScreenOrangeGreen, 435, 51, 51, 51);
		buttonGreenLocked = new Sprite(tex_backgroundScreenOrangeGreen, 384, 102, 51, 51);

		buttonOrange17 = new Sprite(tex_backgroundScreenOrangeGreen, 435, 102, 51, 51);
		buttonOrange18 = new Sprite(tex_backgroundScreenOrangeGreen, 384, 153, 51, 51);
		buttonOrange19 = new Sprite(tex_backgroundScreenOrangeGreen, 435, 153, 51, 51);
		buttonOrange20 = new Sprite(tex_backgroundScreenOrangeGreen, 384, 204, 51, 51);
		buttonOrangeLocked = new Sprite(tex_backgroundScreenOrangeGreen, 435, 204, 51, 51);

		textboxBackground = new Sprite(tex_sprites, 0, 420, 250, 90);

		startSound = game.getAudio().newSound("startSound.ogg");
		clickSound = game.getAudio().newSound("clickSound.ogg");
		music1 = game.getAudio().newMusic("music1.mp3");
		music2 = game.getAudio().newMusic("music2.mp3");
		music3 = game.getAudio().newMusic("music3.mp3");

		font = new TexFont(game);
		font.loadFontAlt();

		game.getAudio().soundEnabled = false;

	}

	public static void reload(Game game) throws Exception
	{
		tex_splash.reload();
		tex_sprites.reload();
		tex_backgroundScreenRedMain.reload();
		tex_backgroundScreenBlueYellow.reload();
		tex_backgroundScreenOrangeGreen.reload();
		tex_splash2.reload();
		font.loadFontAlt();
	}

	public static void release()
	{
		startSound.dispose();
		music1.dispose();
		clickSound.dispose();
		tex_splash.dispose();
		tex_sprites.dispose();
		tex_backgroundScreenRedMain.dispose();
		tex_backgroundScreenBlueYellow.dispose();
		tex_backgroundScreenOrangeGreen.dispose();
		tex_splash2.dispose();
	}
}
